import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

public class as extends ba
    implements br
{

    public u a;
    private int b;
    private int c;

    public as(o o1, u u1)
    {
        this(o1, u1, 0, 0);
    }

    public as(o o1, u u1, int i, int j)
    {
        super(o1, i, j);
        a = u1;
    }

    public final int g()
    {
        u u1;
        if((u1 = a) != null)
            return u1.b();
        else
            return 0;
    }

    public final int g(int i)
    {
        u u1;
        if((u1 = a) != null)
            return u1.c();
        else
            return 0;
    }

    public void a(Graphics g1, bh bh1, o o1, int i, int j)
    {
        u u1;
        int k;
        int l;
        if((u1 = a) == null)
            return;
        k = bh.a(o1.e, i, u1.b());
        l = bh.b(o1.e, j, u1.c());
        if(u1.d()){
        int ai[];
        int i1;
        if(b == 0)
            bh.b().b((br)this);
        ai = u1.c;
        i1 = 0;
_L7:
        while(true){
        int j1;
        int k1;
        int l1;
        if(i1 > c)
            break; /* Loop/switch isn't completed */
        j1 = 2 + 6 * i1;
        k1 = ai[j1 + 2];
        l1 = ai[j1 + 3];
        if(i1 < c){
        switch(ai[j1 + 4]){
            case 2:
                break;
            case 3:
                break;
            default:
                g1.drawImage(u1.b[i1], k + k1, l + l1, 20);
                break;
        }
        }
        else{
        g1.drawImage(u1.b[i1], k + k1, l + l1, 20);
        }
            i1++;
        }
        return;
        }
        Image image;
        if((image = u1.a) != null)
            g1.drawImage(image, k, l, 20);
    }

    public final int b_(int i)
    {
        bh bh1 = bh.b();
        u u1;
        if((u1 = a) == null || !u1.d() || bh1.a((ba)this) == 0)
        {
            b = 0;
            c = 0;
            return 0;
        }
        if(b == 0)
            b = i;
        int ai[] = u1.c;
        int j = u1.b.length;
        int k = i - b;
        int l = 0;
        for(int i1 = 0; i1 < j; i1++)
            if((l += ai[2 + i1 * 6 + 5]) >= k)
            {
                c = i1;
                A();
                return Math.max((b + l) - i, 40);
            }

        c = 0;
        b = i;
        A();
        return Math.max(ai[7], 40);
    }
}